package top.tenebrous.termbor.rpc.protocol.header;

import top.tenebrous.termbor.rpc.common.constants.RpcConstants;
import top.tenebrous.termbor.rpc.common.utils.SnowFlakeUtil;
import top.tenebrous.termbor.rpc.protocol.enums.RpcType;

/**
 * @program: termbor-rpc
 * @description:
 * @author: yazhang6
 * @create: 2024-05-21 09:37
 **/
public class RpcHeaderFactory {

    public static RpcHeader getRequestHeader(String serializationType) {
        RpcHeader rpcHeader = new RpcHeader();
        rpcHeader.setMagic(RpcConstants.MAGIC);
        rpcHeader.setRequestId(SnowFlakeUtil.getSnowFlakeId());
        rpcHeader.setMsgType((byte)RpcType.REQUEST.getType());
        rpcHeader.setStatus((byte) 0x1);
        rpcHeader.setSerializationType(serializationType);
        return rpcHeader;
    }
}
